﻿using CommunityToolkitMvvmDemo.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;

namespace CommunityToolkitMvvmDemo.Selectors
{
    public class ListBoxItemStyleSelector : StyleSelector
    {
        public Style NormalStyle { get; set; }
        public Style AlarmStyle { get; set; }
        public override Style SelectStyle(object item, DependencyObject container)
        {
            var person = item as Person;
            if (person.Age > 70)
            {
                return AlarmStyle;
            }
            return NormalStyle;
        }
    }
}
